package com.biz.primus.ms.depot.dao.po;


import com.biz.primus.base.enums.DepotType;
import com.biz.primus.model.depot.enums.BusinessStatus;
import com.biz.primus.ms.base.jpa.converter.ListStringConverter;
import com.biz.primus.ms.base.jpa.po.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

/**
 * @author JKLiues
 * @date 2017/10/21
 */
@Setter
@Getter
@Entity
@Table(name = "tb_depot", indexes = {@Index(columnList = "districtId")})
public class Depot extends BaseEntity {

    private static final long serialVersionUID = 13768028241706667L;

    /**
     * 门店编号
     */
    @Column(length = 50, nullable = false, unique = true)
    private String depotCode;

    /**
     * 名称
     */
    @Column(length = 100, nullable = false)
    private String name;

    /**
     * 详细地址
     */
    @Column(nullable = false)
    private String address;

    /**
     * 门店经度
     */
    @Column(columnDefinition = "DECIMAL(9,6)")
    private BigDecimal depotLongitude;

    /**
     * 门店纬度
     */
    @Column(columnDefinition = "DECIMAL(9,6)")
    private BigDecimal depotLatitude;

    /**
     * 省ID
     */
    private Long provinceId;

    /**
     * 省的百度名称
     */
    @Column(length = 50)
    private String provinceBaiduName;

    /**
     * 市ID
     */
    private Long cityId;

    /**
     * 市的百度名称
     */
    @Column(length = 50)
    private String cityBaiduName;

    /**
     * 区ID
     */
    private Long districtId;

    /**
     * 区的百度名称
     */
    @Column(length = 50)
    private String districtBaiduName;

    /**
     * 门店类型
     */
    @Column(columnDefinition = "TINYINT")
    @Convert(converter = DepotType.Converter.class)
    private DepotType depotType;

    /**
     * 门店营业状态
     */
    @Column
    @Enumerated(EnumType.STRING)
    private BusinessStatus bizStatus;

    /**
     * 门店营业开始时间
     */
    @Column
    private Timestamp beginBusiness;

    /**
     * 门店营业结束时间
     */
    @Column
    private Timestamp endBusiness;


    /**
     * 门店标签（预留）暂未实现
     */
    @Convert(converter = ListStringConverter.class)
    private List<String> depotTags;

    /**
     * 是否可发快递
     */
    private Boolean enableExpress;
    /**
     * 规模
     */
    @Column
    private String scale;

    /**
     * 上级机构ID
     */
    @Column
    private String orgId;

    /**
     * 上级机构类型
     */
    @Column
    private String orgType;

    /**
     * 面积
     */
    @Column
    private String proportion;

    /**
     * 邮政编码
     */
    @Column
    private String zipCode;

    /**
     * 商圈
     */
    @Column
    private String bizArea;

    /**
     * 联系电话
     */
    @Column
    private String telPhone;
}
